<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #father{
            width: 200px;
            height: 200px;
            border: 1px solid red;
            margin-top: 300px;
            position: relative;
            margin-left: 300px;
        }
        #son1{
            background-color: magenta;
            width: 50px;
            height: 50px;
            position: absolute;
            top: 100px;
            left: 100px;
            /* 绝对定位：相对于已经定位的父元素进行定位 */
        }
        #son2{
            background-color: green;
            width: 50px;
            height: 50px;
        }
    </style>
</head>
<body>
    <div id="father">
        <div id="son1">div1</div>
        <div id="son2">div2</div>
    </div>
</body>
</html>